UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6s2fVceZKyfM6IxbvOwfybhtPERDA+NBifwiMrtiO3Y=' 
WHERE 
  key_id = '8877033d9bab710f9187b0db72ad8fc9c7f6f110ca22267b95e1bccea2604779' 
  AND (
    token = '6s2fVceZKyfM6IxbvOwfybhtPERDA+NBifwiMrtiO3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042