Section 40. If a convict imprisoned under sentence is again sentenced to confinement in a prison other than that in which he is then held, the warrant for his commitment in pursuance of the second sentence shall be placed in the hands of the superintendent or keeper of the prison where the convict is held, and said superintendent or keeper, upon the expiration of the first sentence, shall commit the convict in obedience to said warrant.