Just make sure this is logical explaination and never done practically yet but if get time than I will try.
What you can do by checking loggedin column value from qa_users table
Than calculate with the current date and so you can define something similar below
if(userlastloggedin > 30){
//add your delete user code
}
With this logic I believe you will be able to achieve what you are looking.... By the way I am adding this in my road map for future development.