(d) Whoever, directly or indirectly, corruptly asks, demands, exacts, solicits, seeks, accepts, receives or agrees to receive anything of value for himself or for any other person or entity in return for influence upon the testimony under oath or affirmation of himself or any other person as a witness upon any such trial, hearing or other proceeding or in return for the absence of himself or any other person therefrom; shall be punished by a fine of not more than $100,000, or by imprisonment in the state prison for not more than 10 years, or in a jail or house of correction for not more than 2 1/2 years, or both; and in the event of final conviction shall be incapable of holding any office of honor, trust or profit under the commonwealth or under any state, county or municipal agency. Clauses (c) and (d) shall not be construed to prohibit the payment or receipt of witness fees provided by law or the payment by the party upon whose behalf a witness is called and receipt by a witness of the reasonable cost of travel and subsistence incurred and the reasonable value of time lost in attendance at any such trial, hearing or proceeding, or, in the case of expert witnesses, involving a technical or professional opinion, a reasonable fee for time spent in the preparation of such opinion, in appearing or testifying.