When a party to an action or a person who holds a lien upon the property or a part of it has other securities for the payment of the amount of the lien, the court may order the securities to be exhausted before a distribution of the proceeds of sale, or may order a just deduction to be made from the amount of the lien on the property on that account.