UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oqfE9yEV9fxkb1kzTWKpmC5A76CAzEEF8IigMlp752Y='
WHERE
key_id = '8fab29a205e249afe5caaa12e3fcaf58df4943c3e09eacd8913c64eef39b4bff'
AND (
token = 'oqfE9yEV9fxkb1kzTWKpmC5A76CAzEEF8IigMlp752Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)