UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QO5wjx0CHNIxq/ToZo5pkep8cKNMqiozAUz5YQz6t64='
WHERE
key_id = '2c9c3883b5368769af817f22c3b95bdc0a06d3d7b73232e95da65c91bf1fb7d4'
AND (
token = 'QO5wjx0CHNIxq/ToZo5pkep8cKNMqiozAUz5YQz6t64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)