UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6nYG6kTLqlhqPQhslm6M5B+OxQzYVrMZywt0riruhpI='
WHERE
key_id = 'a89393c0e77f945a17b4980aae4a61c7f459d119c866e50f312cf4f4f8195449'
AND (
token = '6nYG6kTLqlhqPQhslm6M5B+OxQzYVrMZywt0riruhpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)