UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J4KzzLsZlopSRFFcOI5oWQ7Am49nyXmzV+M+IsHzecc='
WHERE
key_id = 'f7c6f9d15364a57e192b9ab8654f28817cde5ddee97344b5750b482c8d4eb07a'
AND (
token = 'J4KzzLsZlopSRFFcOI5oWQ7Am49nyXmzV+M+IsHzecc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)