UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KrA9rG5eHmqOj1UE62W5Wpk6fkgKQbsG6//+iIeY8pM='
WHERE
key_id = '13046bc56eb5bd05a28d4e49087b2a301095c72170685c2fd1289181c7d1c220'
AND (
token = 'KrA9rG5eHmqOj1UE62W5Wpk6fkgKQbsG6//+iIeY8pM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)