UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DAH30eQGetbWRRCboWPJ4MctHsjVv5trWGKyyWBIUUs=' 
WHERE 
  key_id = '925b55c5382eeaf147091d796e0727634ebae55e7f18923a9f70c3f2791a4b09' 
  AND (
    token = 'DAH30eQGetbWRRCboWPJ4MctHsjVv5trWGKyyWBIUUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044