UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cWmaYj00NG8TwE93jgJ8o8WbjohRWuI5bnUTusEQvr8='
WHERE
key_id = 'a0985fef0d3991475b86333b90d7f765d25ec2ff572b411ed578bd8d13a4ca81'
AND (
token = 'cWmaYj00NG8TwE93jgJ8o8WbjohRWuI5bnUTusEQvr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)