Unfortunately, MySQL does not support the CHECK-constraints. They are parsed but ignored.
From the reference manual:
The CHECK clause is parsed but ignored by all storage engines.
You can try to put this check constraint in your business logic before inserting the row.
As Joe Celko says in his book Joe Celko's SQL for Smarties:
Small "pseudo-SQL" products have appeared in the open source arena. Languages such as MySQL are very different in syntax and semantics from Standard SQL, often being little more than a file system interface with borrowed reserved words
A little harsh indeed, but in a way he's correct, since MySQL doesn't support a bunch of Standard SQL features.