There is a standard field for record owner that you can use. If I understand correctly, you want only the record owner to be able to edit the record. In that case, your Error Condition Formula would be simply
$User.Id <> OwnerId
To include Profiles, consider the solution from @sfdcfox. It means that you do not need to consider changes to Profile name, or different Ids in each sandbox for a new Profile until it is refreshed from Production.
If you choose not to, go to the Profile(s) that should be able to edit the record and get the Id of the Profile. Include them in the formula like this:
AND ( $User.Id <> OwnerId, $Profile.Id <> '00e30000001Ja3e', $Profile.Id <> '00e30000001Gs8e', $Profile.Id <> '00e30000001aFo2' )
AND (
$User.Id <> OwnerId,
$Profile.Id <> '00e30000001Ja3e',
$Profile.Id <> '00e30000001Gs8e',
$Profile.Id <> '00e30000001aFo2'
)
Using Profile Id is safer than using the name of the Profile since the name can be edited. If the Profiles that you want to include were already in Production when your sandbox was created, the Profile Id will be the same as it is in Production, so no need to modify the VR in each sandbox.