UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Swgix8HMolbUDeB5Y3NZtQNsglXpIYH0dRfGCXI/5Y0=' 
WHERE 
  key_id = '2767e52501316d3bc383249db51896e3fe1ea74c830bebbd8c93672ead4265eb' 
  AND (
    token = 'Swgix8HMolbUDeB5Y3NZtQNsglXpIYH0dRfGCXI/5Y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059