Insert into a table or update if exists MySQL

DUPLICATE KEY can be used to DUPLICATE to Insert into a table or update if exists in MySQL.

INSERT INTO tableName (id, name, age) 
VALUES(10, "Roy", 34) 
ON DUPLICATE KEY 
UPDATE    
name="Roy", age=34

It will insert a new record if no record exist with id = 10, Otherwise update if any record exist with id = 10;

Please Share