UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U1mvYmkM+1JdbPycIRPkGsrluiQ92K6i9Fsa4PDketo='
WHERE
key_id = 'a33219bd2897b98734320840c93143832b91b80042b6f891d70cac451d7b83a5'
AND (
token = 'U1mvYmkM+1JdbPycIRPkGsrluiQ92K6i9Fsa4PDketo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)