Section 53C. Any police officer, including an officer of the department of state police appointed under section ten of chapter twenty-two C, on duty at night or on vacation, furlough or on a day off, who attends as a witness for the commonwealth in a criminal case pending in a district court, including the municipal court of the city of Boston, or any juvenile court, or the superior court, may, in lieu of the witness fee to which he would otherwise be entitled under section fifty-three or section fifty-three B, as the case may be, be granted such compensatory time off as shall be equal to the time during which he was in attendance at such court, but in no event shall less than three hours compensatory time off be granted him or, if such additional time off cannot be given because of personnel shortage or other cause, he shall, in lieu of said witness fee, be entitled to additional pay for the time during which he was in attendance at such court, but in no event shall he receive less than three hours additional pay.