What makes you think the statute is "unconstitutional?" The Supreme Court hasn't tackled the issue directly, but it upheld a law requiring libraries to install blocking software to restrict access to websites for children: https://en.wikipedia.org/wiki/United_States_v._American_Libr.... Remember that, prior to the reinterpretation of the First Amendment in the mid-20th century, the "obscenity" carve-out was broad enough to outright ban things like pornography, much less allowing access to children.
That said, I suspect that the law is probably unconstitutional, insofar as it's targets at a type of speech (social media) that doesn't fall within any of the traditional exceptions. I don't think the "under 18" rationale holds when you're talking about content that traditionally hasn't been prohibited to children.
Regardless, this isn't an instance of the state blatantly violating some clear Supreme Court precedent. (And even that's okay if you have a good-faith basis for challenging the precedent! That's how impact litigation often works.)