The saying “you are what you eat” may extend to your mood. According to a new study published in Nutritional Neuroscience, what you put on your plate affects your mental health as you age.

For the study, researchers from the State University of New York at Binghamton put out an anonymous Internet survey through social media, which asked nearly 600 people about the foods they eat and the state of their overall mental wellbeing.

After analyzing the responses, the researchers found that eating more poultry and red meat was significantly associated with better mental health in adults aged 18 to 29. But when they looked at people over the age of 30, a higher intake of fruits and vegetables seemed to be more beneficial for their mood.

It all comes down to your brain chemistry, study author Lina Begdache, Ph.D., assistant professor of health and wellness studies at Binghamton told Men’s Health.

Your brain is not the same in your 20s as it is in your 40s. When you’re younger, your mental health seems to be more sensitive to the chemicals in your brain, explains Begdache. “The amino acids in the protein of meat promote production of serotonin and dopamine, the good-mood chemicals,” she says. Exercising at least three times a weeks also seems to have the same effect in the younger group, the study found.

As you age, things start to shift. “Levels of brain inflammation increases,” says Begdache. “Inflammation is a source of free radicals, which cause a major disturbance in the brain. It appears that the need for antioxidants increases with age to feel better.” So while at first your brain relies on essential amino acids, its needs change over time, and antioxidants become a key player in your mood.

Long-lasting inflammation can be harmful, because it triggers your body to start attacking healthy cells, tissues, and organs. In fact, according to research published in JAMA Psychiatry, brain inflammation was 30 percent higher in people diagnosed with clinical depression. As the severity of the brain inflammation increased, so did the severity of the depression, the study found.

That’s where loading up on fruits and vegetables comes in. Colorful foods like berries, spinach, tomatoes, sweet potatoes, and just about anything you find in the produce aisle are antioxidant powerhouses that work to fight the damage these free radicals cause within your brain. That’s important, because this damage might play a part in the brain imbalances that lead to mental health problems like anxiety and depression in anyone.

However, the need for antioxidants seems to be stronger as you get older, says Begdache. Obviously, you want to be eating protein, fruits, and vegetables at any age, but most of us don’t find the right ratio. Data from the Centers of Disease Control and Prevention consistently finds that most Americans just don’t eat enough fruits and vegetables.

7 Foods Doctors Prescribe: 

preview for 7 Foods Doctors Prescribe

Begdache stresses that if your mood feels low, you should take a look at your diet to see if you can fill in the gaps. “I think the best take away message is to look into what we eat in case we experience some form of mental distress before resorting to taking medication,” she says.

Medication when combined with therapy can be effective, but antidepressants in particular can come with unpleasant side effects, like weight gain or sexual problems. So if you’re experiencing the telltale signs of depression in men, you should still check in with your doc. He or she will be able to help you form a treatment that works for you—whether that involves diet adjustments, medication, or therapy.