I do not think you can do it with check constraint.
I would go with an after insert/update trigger -sorry, you have to actually code the logic.