UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g7EJqCTP8GEK58ohh8GLzgrpAg7VhqynjXbzfPrE26g=' 
WHERE 
  key_id = '06a4b2f703039cfb0d5c497c7589dca3cd029e1554d4af82597aae433551c7fc' 
  AND (
    token = 'g7EJqCTP8GEK58ohh8GLzgrpAg7VhqynjXbzfPrE26g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026