UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'euN0w/2NNsT5Ru0AapOuB3TndTKjCvhRgDvzaJtxl0o='
WHERE
key_id = 'f342cfcc9fcf41239657ad83ee8ee33fcc97f773ba0005a79ceced6fca1bdf08'
AND (
token = 'euN0w/2NNsT5Ru0AapOuB3TndTKjCvhRgDvzaJtxl0o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)