UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5XUukJjXUp7cFV+lnyr8NKITaZkoedi2t5A6UXWosF4='
WHERE
key_id = 'ff00e4177f96207e4e98de73c7a06cd37fae92630cf046bd1ce5b66a50ee9922'
AND (
token = '5XUukJjXUp7cFV+lnyr8NKITaZkoedi2t5A6UXWosF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)