UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G74bHegLg2AEDbsB5k67Lqe6pKQBBRKPppPH1GWW3JE=' 
WHERE 
  key_id = 'f14c4f18a819764820d52ad277598d8dece87ec14972820fac662ae47ddb7d6a' 
  AND (
    token = 'G74bHegLg2AEDbsB5k67Lqe6pKQBBRKPppPH1GWW3JE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035