It depends on what you mean by "optimal".
For a dogfight, the optimal age is probably 30. At this age a person has lots of experience, but still maintains their full mental agility, ability to calculate and energy. In a dogfight your ability to think fast and calculate your next move is the critical factor.
For combat missions, however, 40-45 may be more optimal, because experience, judgement and knowledge becomes more important. Knowing when to attack, how to attack, how to make your approach, how to do your mission setup, and many other things become the product of long experience. For complicated missions in enemy territory, it is better to have someone with long experience, rather than a young hotshot.
Once a person hits about 60-65 years in age, their mental ability to calculate declines significantly. Nevertheless, experience can make up for it in some instances. For example, at age 63 Vassily Smyslov was a candidate for the world chess championship, an amazing accomplishment for a person of that age. Emanuel Lasker took 3rd place at Moscow 1935, a premier chess tournament, at the age of 66, which was practically a miracle. These are exceptions, however. In general, once a person gets into their 60s, their mental ability deteriorates. Therefore, the age 50-55 can be considered the maximum age at which experience and judgement can be used effectively in high speed combat situations.
Complex Mission Role
To investigate my basic assertion that optimal age for a combat mission (not air supremacy) pilot is 40-45 I investigated pilot astronauts. Since astronauts are selected from large numbers of candidates and have short careers typically, it is a safe assumption that their average age is what NASA considers to be ideal. According to NASA Technical Report 1304 the mean age for all selected pilot candidates is 39.90 years old. If we assume a pilot has a 5-year career, then my guess for optimal age matches perfectly with NASA's selection choices. This may be considered strong evidence that for a pilot executing complex missions, the optimal age range is, indeed, 40 to 45 years.
Air Supremacy Role ("dog fighting")
To determine the optimal age for air supremacy ("dog fighting"), if we had access to the USAF's (or other country's) exercise data over time, we might get an idea since we could calculate an ELO rating for each combatant and identify to the top exercise fighters of all time. Unfortunately this kind of data is not released as far as I know, probably because the armed services do like naming or identifying particular soldiers. I do strongly suspect, though, that if such a study was done it would show the "best in the world" air supremacy pilots would be clustered around the age of 30. To check this, I tried summarizing statistics from WW2 German fighter pilots. Using birth data on 470 German aces I generated the following plot:
In this chart, the bar chart is the total number of aces grouped by date of birth. The blue dots are the average number of victories for that birth year group. What this chart seems to show is that performance is remarkably consistent between the ages of 18 and 32, with a slight advantage to the younger pilots, but then declines significantly. The 1922 group was significantly skewed by Erich Hartmann. If we eliminate him as an outlier, the top group is the class of 1920 which would have been between the ages of 19 and 25 during the war. This seems to show my original guess was wrong, and that dogfighting is dependent more on quick reflexes and fast thinking than on experience, which hands the edge to the young.