An action upon a statute for a penalty given in whole or in part to the person who may prosecute for the same, shall be commenced within three years [one year] after the commission of the offense; and if the action be not commenced within one year by a private party, it may be commenced within two years after the commission of the offense in behalf of the state by the prosecuting attorney of the county, where said offense was committed.