UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't8Spg2PlXx8Iglg0q5q3fiHbD3TNyBG9KgneO2faL2o='
WHERE
key_id = '38db8dfdc4e07f6702d8df1e015e272aa7f9cb26218fd9ec75ded265a74e4fb5'
AND (
token = 't8Spg2PlXx8Iglg0q5q3fiHbD3TNyBG9KgneO2faL2o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)