UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZzK3Y8x2Eo6NIlgmCFaN3f8dOdEhCtd+7w6+a65mhms=' 
WHERE 
  key_id = '40ac2aa541c789d3903ac7b383aa8170268b5cdc5b632053420e7cb870e924a4' 
  AND (
    token = 'ZzK3Y8x2Eo6NIlgmCFaN3f8dOdEhCtd+7w6+a65mhms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047