UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CAgmDg36Z1wajF8lSKsKe6MJHum1c2rAKA74hjo+DnI='
WHERE
key_id = 'ed42eeeb4a539b174b46fec9c96d188a45df4fe21f7f1fe835de896a71dd99dd'
AND (
token = 'CAgmDg36Z1wajF8lSKsKe6MJHum1c2rAKA74hjo+DnI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)