§ 20. Discharge of lien after notice of lien filed by payment of money into court. A lien specified in this article, other than a lien for performing labor or furnishing materials for a public improvement, may be discharged after the notice of lien is filed at any time before an action is commenced to foreclose such lien, by depositing with the county clerk, in whose office the notice of lien is filed, a sum of money equal to the amount claimed in such notice, with interest to the time of such deposit. After such deposit is made and the lien is discharged the county treasurer or any other officer with whom the money is deposited shall, within ten days thereafter, send a notice by mail to the lienor, at the address given in the lien, that such lien has been discharged by deposit. After action to foreclose the lien is commenced it may be discharged by a payment into court of such sum of money, as, in the judgment of the court or a judge or justice thereof, after at least five days' notice to all the parties to the action, will be sufficient to pay any judgment which may be recovered in such action. Upon any such payment, the county clerk shall forthwith enter upon the lien docket and against the lien for the discharge of which such moneys were paid, the words "discharged by payment. " A deposit of money made as prescribed in this section shall be repaid to the party making the deposit, or his successor, upon the discharge of the liens against the property pursuant to law. All deposits of money made as provided in this section shall be considered as paid into court and shall be subject to the provisions of law relative to the payment of money into court and the surrender of such money by order of the court. An order for the surrender of such moneys to the lienor or depositor may be made by any court of record having jurisdiction of the parties. If no action is brought in a court of record to enforce such lien, such order may be made by any judge of a court of record. If application for such order is made by lienor it shall be on notice to the depositor; if made by the depositor then on notice to the lienor.