If any clerk shall knowingly and willfully do any act contrary to the duties of his office, or shall knowingly and willfully fail to perform any act or duty required of him by law, he shall be deemed guilty of a misdemeanor in office.