For a general statement:
* J'ai vécu pendant 45 ans. (This is the most straightforward translation.)
If you're specifically talking about living in a certain place:
* J'ai vécu 45 ans ici. (I lived 45 years here.)
* J'ai habité 45 ans à [place name]. (I lived 45 years in [place name].)
To emphasize the duration:
* J'ai passé 45 ans de ma vie [à faire quelque chose]. (I spent 45 years of my life [doing something].)
To emphasize the past:
* J'ai vécu 45 ans, et maintenant...? (I lived for 45 years, and now...?)
Choose the translation that best suits the context of your conversation.