fixed #846, improved query findByXXXExpiration, fixed warn_expiration email issues