if it is painful, or irritating, it could be a stye - an infection of the oil glands of the eyelid. You can buy a cream over-the-counter for it.
if you look at your sleeping hamster, you can see they have eyelids
Take it to the vet
it might be cancer, take him or her to the vet!!
It depends on the tipe of hamster you have to be more specific