It is Legal to have them on the boat but you must also have the correct amount of non-expired flares on the boat. Keep them separate so you don't get confused if the Coastguard should do a spot check. If you need to use a flare try the expired ones first that way you won't waste the current ones.
I keep both outdated hand held and 12 ga shell flares but you do need to have current flares if you are boarded and checked.
As long as there is no signs the flares are deteriorating they will still work. The spotter plane or passing boater wont be able to tell the old from the new