UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CQF46li87sgB9I+GnCIYhDQP7hvYYlFZEKUD1DtCjUI='
WHERE
key_id = 'dc51ad4f3903c29522b62bab7a5509c76dd4d9ae089d30e11f43b67663145890'
AND (
token = 'CQF46li87sgB9I+GnCIYhDQP7hvYYlFZEKUD1DtCjUI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)