UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'evjvijPQLxUlRv+kzZmiBY3Al+G7hl40KzIv5TT7Xr4='
WHERE
key_id = 'e82a77d4ded98fbd2476278eb334b10cfed83a12375cdb8ad7d4b0f77e3a9bb3'
AND (
token = 'evjvijPQLxUlRv+kzZmiBY3Al+G7hl40KzIv5TT7Xr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)