UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X1ZMCS7PQZhwfsbek31B1NuRWH3ybyMkEM2xNf8hVEk='
WHERE
key_id = '826be5f4aca91a6778025f896dd2cea1d45cb7081ce88925f818df36e81ced9e'
AND (
token = 'X1ZMCS7PQZhwfsbek31B1NuRWH3ybyMkEM2xNf8hVEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)