UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OFLYPI1x6hsy6rPgnqhMylWocNKqNP4EIgvQQNG4T4o='
WHERE
key_id = '6b22ffb70f4616dbb74830a1c69ffc79166c3611b8a5c02e65c1de4e516c3a1e'
AND (
token = 'OFLYPI1x6hsy6rPgnqhMylWocNKqNP4EIgvQQNG4T4o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)