UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PHeSm7tNdiDtI76q+aFgTXRcAh/14gfn0G87O5AW4K0='
WHERE
key_id = '8ebee3d1349085b77e52f205b12488cc7e56ef59e6f32cb4ff3260509cb2fd96'
AND (
token = 'PHeSm7tNdiDtI76q+aFgTXRcAh/14gfn0G87O5AW4K0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)