UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wIlZUtj8OCW/W93vGbYqjp0RwPMDGGrqA/xYjjIxAO0='
WHERE
key_id = 'c7b2288ae91d848ac6f70951a8a6bc2f39093edc5b15e7f184cd20d529639505'
AND (
token = 'wIlZUtj8OCW/W93vGbYqjp0RwPMDGGrqA/xYjjIxAO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)