Researchers say regular exercise between the ages of 45 and 64 can reduce your risk of heart-related ailments. After that, exercise doesn’t help much there.

Middle-aged people have a 20-year window to improve their heart health and stave off some of the impacts of a sedentary lifestyle.

It takes about two years of exercising four to five days a week to accomplish, but the results are improved elasticity in blood vessels that lead to a reduced risk of heart disease.

Those are the conclusions of a new study that may give hope to those wondering what, if anything, they can do to reverse the well-chronicled negative effects of decades of sitting at desks, on couches, and in the car.

The researchers analyzed the hearts of 53 adults between the ages of 45 and 64 as they performed different exercise programs over the course of two years.

Some of the adults, who didn’t have a history of exercising regularly before the study, did a progressively intensifying aerobic routine while the rest did yoga and balance and weight training.

The aerobic exercise group saw an 18 percent improvement in maximum oxygen intake and a 25 percent increase in plasticity of blood vessels, reducing the risk of heart disease.

When those two years of regular exercise take place may not matter, as long as they’re in the 20-year window, said Dr. Benjamin Levine, a study co-author and director of the Institute for Exercise and Environmental Medicine at Texas Health Presbyterian Hospital Dallas and the University of Texas Southwestern Medical Center.

The 45-to-64 range is key, he told Healthline.

“After 70, it is too late. Obviously before 45, there is still lots of plasticity,” Levine said.

Exercise can offer other cardiovascular benefits after 65, but not so much to the “stretchiness” of blood vessels in the heart.

“It’s just that the structure of the circulation becomes increasingly fixed as you get older,” he said.

The stiffening of the heart muscle and of the vessels in it can lead to the reduction or stopping of blood flow through the heart, which can in turn lead to less blood flowing to the other organs.

Levine noted that a previous study had found that a year of exercise had little impact on cardiac “stiffening” in people over age 65.

Another study found that stiffening occurs mainly between ages 50 and 64, and that interventions may be most impactful during that time.

The routine followed by participants in Levine’s study included two to three days of moderate-intensity exercise, one high-intensity session such as four-by-four interval training, a weekly strength-training session, and a weekly longer session of various types of aerobic exercise.

Many people, however, may not be healthy enough — or have the time or interest — for such an exercise regimen.

And the study’s participants were mainly white, so it’s possible the results may not apply to the general population.

Levine said the research is continuing. His team is now studying patients who have especially high risk of heart failure with preserved ejection fraction (HFpEF). That can be caused in part by stiffening of the ventricular tissue and is tied to hypertension and obesity.

Levine said he hopes to see whether exercising has benefits for them as well.