UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sfRqWeaYnlQC+LMsnzK9EYzq5kXfWNjHGPBLHSWb50s='
WHERE
key_id = 'a9ad5213dbb4eb3a904b6c4d82692a5f424c4849d1e1def9a2b87a9c1fb25f3f'
AND (
token = 'sfRqWeaYnlQC+LMsnzK9EYzq5kXfWNjHGPBLHSWb50s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)