CAS-1389: Logout fails as an error happens when tickets are marked as expired

change debug message and add a test to confirm the correct behaviour