Job security is there in govt jobs but the earning potential is not much. Also I guess people joining after 2004 are part of NPS for pension, not sure if it's as good as the old scheme that existed.
What is it that you want to do? Coast through a job or do something more than just learning a new tech as time goes by? If it's the first then you can definitely find it in private sector as well (might have to ask around where this sort of env exists).
If it's latter, from what I have seen, you can try for different posts than a Dev, for example become a Project or Engineer Managar, Architect. I don't believe software is always about adopting new things, it's also about knowing how to solve something. Look at your organisation as well, what post do you think would be most suitable to you? Work towards that.
Meanwhile you could try applying to govt jobs if you still feel govt job is what is right for yoy, not sure about age restriction. Also jumping companies will definitely give you a good hike.
P.S: Seeing the privatization going on, I would only go to public sector if I have a backup in private sector. There won't be such thing as job security, thanks to overpopulation, and deteriorating quality of life/resources.