UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2tegXVD3Fm/TNhvu8t94ih4MVhH0PfFzvwRGj2XN6A8='
WHERE
key_id = 'c8af3cb063217ea17ec2be948fe59d64c1f5a966e356e5de93305f5095a64bd9'
AND (
token = '2tegXVD3Fm/TNhvu8t94ih4MVhH0PfFzvwRGj2XN6A8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)