Queryq=entityManager.createQuery("select au from ResetPasswordToken au where lower(au.login) = :login and au.token = :token and (au.used is null or au.used = :used)");
Queryq=entityManager.createQuery("select au from ResetPasswordToken au where lower(au.login) = :login and lower(au.token) = :token and (au.used is null or au.used = :used)");