I want to achieve something like this:
update bill b set b.isPaid = (if(select count(*) from bill_payment p where p.bill_id = b.id) > 0,true,false);
I would suggest writing this using
UPDATE bill b SET b.isPaid = (EXISTS (SELECT 1 FROM bill_payment p WHERE p.bill_id = b.id ) );
EXISTS clause returns a boolean, so there is no need to explicitly use
FALSE (unless you really, really want to).
I strongly recommend using
EXISTS instead of
COUNT(*) for this purpose, because it often has much better performance.
EXISTS can stop at the first matching record, instead of having to count all matching records.