DECLARE coins_take int(11);
SET coins_take = 1;
UPDATE users
SET users.coins_ready_to_collect = CASE
WHEN users.farmboost_buy='Yes' THEN users.coins_ready_to_collect + coins_take * 2
WHEN users.farmboost_buy='No' THEN users.coins_ready_to_collect + coins_take
END
WHERE users.id > 0;
DECLARE is permitted only inside a BEGIN ... END compound statement and must be at its start, before any other statements.https://dev.mysql.com/doc/refman/8.0/en/declare.html