Even though the question may have been asked with
the best intentions, it could be problematic.
If the candidate is over 40, they are in a protected class to prevent
age discrimination. They may construe the question as being an attempt
to ascertain their age. It is illegal to ask someone's age during
a job interview.
The "Screen Candidates" and "Interview & Choose"
sections of this site will give you more information on illegal