Well, they also have a tube in the throat they can extend to breath when they are eating large meals... forgot the official term for this, but my thoughts were that the mucus could come from there as well.
Think of it as the snake version of coughing up a loogey, except that reptiles don't normally produce enough mucus to do this, so if they do, it's a bad thing.