UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6F9VFiqYUMcRO2cMiS7YgpF7pJVeQBwn/lKnw/9Rla4='
WHERE
key_id = 'c6df680b5c4cd2e2a8affe81a2a7f2333511e214d0492f057b4e5b3133bf5845'
AND (
token = '6F9VFiqYUMcRO2cMiS7YgpF7pJVeQBwn/lKnw/9Rla4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)