non basta fare
codice:
...where (id_scaffali<>22 OR user_id=0)...
?

vedi tu se OR o AND