i dont think you would get an std because youre not having sex with someone else, now, in the case of Crabs, I would recommend the public restroom to be clean.
If caught there COULD be legal repricussions. Especially if you were to even accidently expose yourself-esp. in front of a child. Otherwise, wash you hands before and after. Also, I wouldn't sit on the toilet. I would recommend finding a better place...such as the privacy of your home.
Not dangerous, just embarrassing if you are caught. HIGHLY unlikely to contract any std in this manner ever.
Strange place to masturbate, though.