UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XlkNyLzS9WxozWKVw7fEHOMyh1YqVVRCri9k+ob2gvE='
WHERE
key_id = '8c112ed13327ec1f33382d0e5c63b034f47e71f0df6c0a76569d7ebf43b523de'
AND (
token = 'XlkNyLzS9WxozWKVw7fEHOMyh1YqVVRCri9k+ob2gvE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)