My understanding of Star Wars canon is that droids were programed to simulate emotions in order to better interact with Humans and other living beings.
They are also programmed with a sense of survival, unless they are protecting a living life form (which is why in Episode 1, the astromechs – R2-D2 and other like him, barely flinched when fixing Padme’s ship)
But they also learn, and can utilize information from previous experiences, which is why most astromechs and other droids routinely have their memories wiped. It’s also why Padme, Anakin Skywalker, Bail Organa, Luke Skywalker, & Princess Leia never wiped R2-D2’s memory. That’s also why R2 become a little eccentric.
Also, in Return of the Jedi, Jabba’s people were not torturing droids. They were branding them and destroying them. However, since his crew were evil, it’s possible that they were practicing torturous techniques on the droids in preparation for living people or out of pure boredom.
Anyway… the droids do not experience pain (if they did C3PO would have experienced pain many times), but they do react to things that damage them out of their programing to protect themselves when possible (though they are also programed to sacrifice themselves if needed to save lives)
NOTE: battle droids lack the programing to protect life. They are programed to simply follow orders.
So – no, Star Wars does NOT have living droids. There is nothing in Star Wars like “Data” or “The Doctor” in Star Trek.