UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'juP6BhDV9qgUBIyGZFNWgoADyG4jVIzI2Cyc9jDLnKE='
WHERE
key_id = '996c6d73d6baa270647e0b70ebac1b2ae7e9f9fc5c88562de1e2ed8f64ba3933'
AND (
token = 'juP6BhDV9qgUBIyGZFNWgoADyG4jVIzI2Cyc9jDLnKE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)