Hey, Im wondering if you can do this in SQL. I have searched google and can't find what I'm looking for to explain it to me.

Is this possible? What am I doing wrong?
Or is this something I should do through PHP with multiple queries?

Basically it's a conditional statement.
These are fake values, Im just trying to learn if it can be done
Code MySQL:
    IF 
    NOT EXISTS 
        (
        SELECT user_id, bot_id 
        FROM tmp_battles 
 
        WHERE user_id = 1 
        AND bot_id = 5
        ) 
 
    THEN 
 
        INSERT INTO tmp_battles 
        SET  
        user_id = 1,
        bot_id = 2
 
 
 
    ELSE
 
        UPDATE tmp_battles
        SET
        user_id = 1,
        bot_id = 55,
 
        WHERE user_id = 10
        AND bot_id = 55
 
    END IF

Or what about something like this:

Code MySQL:
 IF 
   (SELECT COUNT(*) FROM items WHERE id = 1) > 10
THEN
    DO SOMETHING
ELSE
   DO SOMETHING ELSE