The first is fine if the speaker is thinking of 'ten years' as a period of time. The second is fine if the speaker is thinking of the number of years.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.