Membership 2 expired membership hook

I want to write a hook in functions.php. When user's membership expires I want a hook to fire in which I can redirect him to buy new membership.

So, when the user login, if his membership expired, he/she should be redirected to the memberships page.
How do I do this?