UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5PIDBkBwjUOk3D1bhB7wwbEvayqgg5LwdzpwZUkvyaY='
WHERE
key_id = '445db29e57dcd312027a16f89e2380f4f5b7bd712221536abc298b2840b1bd04'
AND (
token = '5PIDBkBwjUOk3D1bhB7wwbEvayqgg5LwdzpwZUkvyaY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)