UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tjwNKXH2xgIWT71+783CrZ5oDnt92+q1+8WT+UH/X7g=' 
WHERE 
  key_id = 'd895437eef7d4526135f9742cf825481d130c6ab15b92c1f1d49e9805dfad507' 
  AND (
    token = 'tjwNKXH2xgIWT71+783CrZ5oDnt92+q1+8WT+UH/X7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028