UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yL1CrMithCbmrWpI4cPQk5rgsWLcetGsFEPiiEssc7g=' 
WHERE 
  key_id = '25730e585ddd7d3d7fabfc51a7470d2beb9f9568e17d4c71fe7d61dfc6538029' 
  AND (
    token = 'yL1CrMithCbmrWpI4cPQk5rgsWLcetGsFEPiiEssc7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029