http://www.nhs.uk/medicine-guides/pages/MedicineOverview.aspx?medicine=Original%20Andrews%20Salts
"If your medicine comes in a plastic container, you must dispose of the container and any remaining contents three months after opening it. It is a good idea to make a note of the date when you first opened it."
Note: I am merely quoting what this website says, not necessarily agreeing with their advice. In fact I wouldn't mind learning the reasoning behind the need to dispose of the mixture after an arbitrary time period.
At the top of the page, it says the ingredients are just Sodium Bicarbonate, citric acid and magnesium sulphate and they would need to undergo some kind of chemical transformation to become in any way harmful. "Reacting with what?", I'd have to ask.
The mixture has gone hard merely from absorbing moisture from the air (look up: hygroscopic). Ordinary table salt does something similar and you may notice "anti-caking agent" in the ingredients list.
It may be that chemical changes occur over time, due to exposure to air/moisture which, whilst not actually harmful to you, somehow render the medicine wholly or partly innefective, causing you to take extra doses to relieve symptoms. The website, above, mentions that excessive levels of magnesium can be harmful to patients with kidney problems so, in a convuluted way, there is a valid reason to throw it away.