UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2fxQMiU26Ieul66ztkZ/KSxHNbw7zIb8T42o1yyOHr0='
WHERE
key_id = 'e65fad0d387b0a4581fefa6c8b963512c9ff860691e89db2e4d8ca3293c752dc'
AND (
token = '2fxQMiU26Ieul66ztkZ/KSxHNbw7zIb8T42o1yyOHr0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)