UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wHQtET6Ke1w7WcYy4IpIN9/CyWPSxZ0uJoCHFKcqCbk='
WHERE
key_id = 'b2f8d0408ebab961ad1858c49fac9b26d1d561688af4706f8669742df6870171'
AND (
token = 'wHQtET6Ke1w7WcYy4IpIN9/CyWPSxZ0uJoCHFKcqCbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)