MySQL: execute an "UPDATE" only if an specific row exists
The IF statement can only be used inside Stored Routines.  This explains the syntax error.

Are you trying to change all rows in the table if a certain row exists?

It's a bit clumsy, but here is a purely SQL way:

SET @x := EXISTS ( SELECT * FROM gallery_image WHERE position = 8 );
UPDATE gallery_image
    SET position = - position
    WHERE @x;


(It is not normal to change all rows of a table.  What is the application doing?  Can it be achieved without such a massive query?)

If you only want to change the one row with 8:

UPDATE gallery_image
    SET position = - position
    WHERE position = 8;