Section 20. A person indebted to a bank may, when proceeded against for the collection of such indebtedness or for the enforcement of any security therefor, set off or recoup the amount of a deposit in such bank held and owned by him at the time of the commencement of such proceeding; provided, however, that if a proceeding in equity has been commenced to restrain the bank from doing its actual business, or if possession of such bank has been taken over by the commissioner as provided in section twenty-two of chapter one hundred and sixty-seven or as otherwise provided by law, no deposit shall be so set off or recouped by any such person unless held and owned by him on the date of the commencement of such proceeding or of possession so taken, and the right of set off or recoupment shall be determined as of such date whether the indebtedness of the depositor, or the deposit, is then due or payable or becomes due or payable at a later date. Any indebtedness against which a deposit is permitted to be set off or recouped as aforesaid may be secured or unsecured. Section three of chapter two hundred and thirty-two shall not apply to a set off hereunder, except that any party to a joint account may set off the joint deposit against his individual debt to such bank. Notwithstanding the foregoing, a judgment shall not be rendered against such bank in favor of the defendant for any balance found due from it if a proceeding in equity has been commenced against the bank or possession thereof has been taken as aforesaid. The word “deposit”, as used in this section, shall include interest due thereon.