The idea that previous generations only lived into their 40s is a myth. 40 plus is the average age if you take everybody whoever lived at a certain period whether as little as 1 hour or to over 90 and averaged it.
What people forget is that in the 19th century as many as 30% of children died before they were 5 while now it is only 2% and that very high child mortality rate dragged the average age down. A quick example below
Age at death: 1,2, 3, 4, 5 40, 50, 60, 70, 80. Average age at death 31.5 years
Age at death: 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, Average age at death: 42.5
Inn the 19th century my family lived in abject poverty in the slums of dockland in London, most lived into their 50s, and several into their 80s. There was nothing exceptional in this.