This should work but double check it:
location / {
valid_referers none blocked *.semalt.com semalt.com;
if ($invalid_referer) {
return 403; }
}