UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N+qYpaDxQ41p2YEhym0txKITf6Cw1LA1nPC3UHz/5rs='
WHERE
key_id = '052a6b50b8a1f13d6d23f3ece880ed051170e095fd0407df216f9b5550e28c7a'
AND (
token = 'N+qYpaDxQ41p2YEhym0txKITf6Cw1LA1nPC3UHz/5rs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)