The local agency shall not release, assign, sell or dispose of any such lien or property unless there is first paid to it a sum of money at least equal to the total of the amount paid for the lien or property by it, all accrued penalties and delinquencies, and necessary expenses incurred.