UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8vg1z+p6WMeNPTADSq6F1uSgEZPWcILCYhf0aQHuPjc='
WHERE
key_id = 'dee3af6b0a058ac3b6940599556d4b5d1b1e046e11587eaf6a2faa49fba7e7e9'
AND (
token = '8vg1z+p6WMeNPTADSq6F1uSgEZPWcILCYhf0aQHuPjc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)