Even if you have the apartment appraised. After 5 of a total of 30 years, you have barely paid down the loan, and probably still have a prepayment penalty. Then there are the already paid incidental purchase costs of the apartment. Is there really that much left over to make the sale worthwhile?
I assume roughly 5 years in possession and bought 6 years ago.
In Filder, for example, the price index for new builds was around 3500 in 2014, 3700 in 2015, and currently just under 6000 euros per m2.
Let's say the apartment is 100 m2 and from the fictitious 350 TE, let's leave 300 TE of credit outstanding, which then results in 250 TE profit before tax, but also after tax in case of owner-occupancy.
The incidental costs are already gone anyway, but mentally you've already absorbed them! So there should definitely be something left over!
The financing can possibly be transferred to the new property through a pledge exchange, using the profit from the sale as equity. With 420 TE for the land, that leaves 130 TE from the sales proceeds (120 TE proceeds plus 300 TE old credit). The 160 m2 WITHOUT a granny flat can be had heavily for 370 TE plus 50 construction incidental costs, so 290 TE are still missing.
290 TE over 20 years with 3.5% repayment and 1.5% interest is 1200 euros with 50 TE residual debt. If you can stretch the old credit down by 700 euros, you would theoretically have 500 euros more to pay per month and in return get a house instead of an apartment. I would avoid doing both together.
Now you should only insert your real numbers into my example, because we don’t know them here.