Optimal Liouville theorem for a semilinear Ornstein-Uhlenbeck equation