بسم الله الرحمن الرحيم
It is a condition that the gold of each side are equal in weight in case the old gold is exchanged with new one and the extra money in any side is interest which is haram. If you sell the old gold with money and both of you take them into your possession and then buy the new gold from that money or with some extra money then it is lawful. In this case, the exchange of gold is not with gold, rather it has two transactions instead of one and both the transactions are lawful i.e. the old gold was sold with money and the new gold was bought with money. Thus, both the transactions are lawful.
Allah knows Best!
Darul Uloom Deoband
This answer was collected from the official ifta website of Darul Uloom Deoband in India.