Yes... at least, specifically, if you used the "Windows Update"
tool, after being "invited", to install Windows 10. It won't
expire, at least as long as they maintain Windows 10, which
they say is forever, and, as long as Windows 10 supports your
model of computer, which is probably forever, too.
But maybe not if you buy a new motherboard.
And, as I say, I don't know how you would do it, if you
wanted to erase Windows from your computer and then install
it again - which some people like to do. They will take
Windows 10 out of Windows Update after a year, I think.
But it is also possible - or it has been - to download
or buy the Windows 10 upgrade on USB or optical media (DVD).
I think /probably/ that copy will work any time after you
get it. You'd better have a good backup copy of that,
so that you don't lose it if one copy is lost, or stops
working.