diff --git a/synapse/storage/schema/delta/30/public_rooms.sql b/synapse/storage/schema/delta/30/public_rooms.sql
index a48604faa89d643d740d14addcc07adfe3892fc6..3400898ed00316673c8c2f827d3bf610217895ca 100644
--- a/synapse/storage/schema/delta/30/public_rooms.sql
+++ b/synapse/storage/schema/delta/30/public_rooms.sql
@@ -16,6 +16,6 @@
 
 /* This release removes the restriction that published rooms must have an alias,
  * so we go back and ensure the only 'public' rooms are ones with an alias.*/
-UPDATE rooms SET is_public = 0 WHERE is_public = 1 AND room_id not in (
+UPDATE rooms SET is_public = (1 = 0) WHERE is_public = (1 = 1) AND room_id not in (
     SELECT room_id FROM room_aliases
 );