UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H6mOREKlWqEpNJznCXJ7QeZ9F7zPd5Egz0CSu8wAR04='
WHERE
key_id = 'bdd201bd7d553a6dda094d91fd938dac4dc6fc71b370633049755c5fa9387cfd'
AND (
token = 'H6mOREKlWqEpNJznCXJ7QeZ9F7zPd5Egz0CSu8wAR04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)