UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '81hXePL6EwnHlHzd0N6U1HBe1UfHm59ON6jL9Wfq7H4='
WHERE
key_id = '3d15cb1eaf06d04e153dfc0c8183ab5125ffada5c258a100226148bbb6d975ab'
AND (
token = '81hXePL6EwnHlHzd0N6U1HBe1UfHm59ON6jL9Wfq7H4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)