Where to show session has expired

Our web app has idle time-out of 30 minutes. Ideally it won't happen, but if it occurs, how to inform the user?

My thoughts are

  1. Prompt the user when attempting (clicking item/keyboard action) at the 31st minute, that session has expired and log in again

  2. Redirect the user to login screen, and overlay message, logged out due to inactivity.

Preferring to go with the second option. Any other alternatives or suggestions, please.