After the defendant is found guilty except for insanity pursuant to ORS 161.319, the court shall order that the person be discharged from custody if:
(1) The court finds that the person is no longer affected by a qualifying mental disorder, or, if so affected, no longer presents a substantial danger to others and is not in need of care, supervision or treatment; or
(2)(a) Each offense for which the person is found guilty except for insanity is a misdemeanor; and
(b) The court finds that the person does not present a substantial danger to others that requires commitment.