UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/6lAoayjFpM5eI8vCMVbs8Hu6Z7teCywjPd1cmmoZFw='
WHERE
key_id = 'aa6d69daf72dae5247a2c1523679dab91d48783839fa8b42b33ef8c79bb97945'
AND (
token = '/6lAoayjFpM5eI8vCMVbs8Hu6Z7teCywjPd1cmmoZFw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)