Delete user not loged in from a long time

Is possibile to delet the user that not logged in from 90 or more day? Is possible with a query on MySQL?

There is a value in the database for the last login. You could make a script that check the value and delete the user after 90 days

have you a suggest for me?