UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xELku1MgjzWVRFIwfEmwHF8tPj4qJkRy5Kg+31Wds9Q='
WHERE
key_id = '91e00af60bd5f212cd21408509378678902194cc0dab8b5afc56c4c4e230bce1'
AND (
token = 'xELku1MgjzWVRFIwfEmwHF8tPj4qJkRy5Kg+31Wds9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)