UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SmpDwjXJ8PlAegLxzHBg/gZFXd7cMk3mRR/E4QDwRIw='
WHERE
key_id = 'd85bed4f5fb8254c568c784e94743b9083646e75328635a103164695f5f64dfb'
AND (
token = 'SmpDwjXJ8PlAegLxzHBg/gZFXd7cMk3mRR/E4QDwRIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)