(a) Except as provided by Subsection (b), an order issued under Section 574.106 expires on the expiration or termination date of the order for temporary or extended mental health services in effect when the order for psychoactive medication is issued.
(b) An order issued under Section 574.106 for a patient who is returned to a correctional facility, as defined by Section 1.07, Penal Code, to await trial in a criminal proceeding continues to be in effect until the earlier of the following dates, as applicable:
(1) the 180th day after the date the defendant was returned to the correctional facility;
(2) the date the defendant is acquitted, is convicted, or enters a plea of guilty; or
(3) the date on which charges in the case are dismissed.