You could buy tickets through the NMBS/SNCB app. These count as a valid ticket. Only available for iOS (Iphone). Other operation systems have the app, and you could look up timetables, but it is not possible to buy tickets through these apps (yet). Only through the iOS app.
Via mobile website
You could buy tickets through the mobile website at m.sncb.be. You need to register on the website, to be able to buy tickets though. The ticket will be send through SMS, which would be valid for your journey. If you plan on buying tickets through your smartphone, I would suggest downloading the app instead.
On the train
You could buy tickets from the train conductor. He will charge normal prices, unless tickets were sold at the station you got on, which is usually the case. If this is the case, you will have to pay a € 3 surcharge.
More information can be found at the official website.
General note about buying late tickets
You are supposed to have a valid ticket when you board the train. Whether it be a pass, a card or a single ticket, you are supposed to have paid for your journey before you enter the vehicle. While the conductor will not kick you out, nor will you get arrested for this, it would be considered back conduct. Therefore if you are planning on buying a ticket through the conductor it would be preferred to approach the conductor, when you board the train. He will be the last person to enter the vehicle, so he will be easy to spot from the platform anyway.
Extending your ticket
I cannot find anything about ticket extension on their website, so this part will just be my opinion. Heck, if there are no real regulations, it might even depend on the conductor's mood what will happen. If they have such a function on their ticketing device, then you will probably just pay for the difference in price between your new and old ticket. If they don't have such a function, they might ask you to pay for a new ticket. Belgian train prices are cheap, so both would probably be quite okay. Regardless, it would probably be best to ask the conductor before you pass your destination. This way it wouldn't look like you wanted to freeload a few stations, hoping you wouldn't meet the conductor until you got off.