The border guards will only care whether your visa is valid at the time you actually enter the Schengen area. It should not matter how long time you have been traveling by then to get there.
There might be a risk that the airline’s check-in/boarding agents at wherever you depart from could be unaware of how the rules work, and therefore try to deny you boarding. This should not happen, but it might be best to ask the airline in advance what their policy in these cases is.
Credit:stackoverflow.com‘