UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yXe+Mk9VfE1KJKFnrqyAnU2sei4GwxrGmklyB660Dws='
WHERE
key_id = 'ce8a00fba3fff3647c293b2ef55c1ef3dc0b6e0339841b3205048c8385167087'
AND (
token = 'yXe+Mk9VfE1KJKFnrqyAnU2sei4GwxrGmklyB660Dws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)